<template>
	<view class="content">
		<view class="box">
			<view class="title_box">
				<img src="../../static/image/minejijian_icon_putong@2x.png" alt="">
				<view class="title_msg">
					<view class="title_title">普通寄件</view>
					<view class="title_sub">终端录入的寄件信息列表</view>
				</view>
			</view>
			<view class="data_box">
				<view class="data_title">待打印运单：</view>
				<view class="data_count">{{list_data.wait_print_count}}单</view>
			</view>
			<view class="border"></view>
			<view class="data_box">
				<view class="data_title">待揽收运单：</view>
				<view class="data_count">{{list_data.wait_collect_count}}单</view>
			</view>
			<view @click="go_print_list" class="btn">查看普通寄件列表</view>
		</view>
		<view class="box">
			<view class="title_box">
				<img src="../../static/image/minejijian_icon_pici@2x.png" alt="">
				<view class="title_msg">
					<view class="title_title">批次寄件</view>
					<view class="title_sub">PC端批量导入的寄件信息列表</view>
				</view>
			</view>
			<view class="data_box">
				<view class="data_title">待打印批次：</view>
				<view class="data_count">{{list_data.wait_print_batch_count}}批</view>
			</view>
			<view class="border"></view>
			<view class="data_box">
				<view class="data_title">待揽收批次：</view>
				<view class="data_count">{{list_data.wait_collect_batch_count}}批</view>
			</view>
			<view @click="go_batch_list" class="btn">查看批次寄件列表</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				token: '',
				log_state: false,
				list_data: {
					wait_print_count: '-',
					wait_collect_count: '-',
					wait_print_batch_count: '-',
					wait_collect_batch_count: '-'
				},
			}
		},
		onShow() {
			// 获取token
			uni.getStorage({
				key: 'token',
				success: res => {
					console.log(res)
					this.token = res.data
					// 获取信息
					this.$https.get(`api/mini_customer/v1/orders/list?token=${this.token}`)
					.then(res => {
						this.list_data = res.data
					})
				},
				fail: res => {
					uni.redirectTo({
						url: '../login/login'
					})
				}
			})
			
		},
		methods: {
			// 点击跳转普通面单列表页
			go_print_list () {
				uni.navigateTo({
					url: "../defaultOrderList/defaultOrderList"
				})
			},
			go_batch_list () {
				uni.navigateTo({
					url: "../batchOrderList/batchOrderList"
				})
			}
		}
	}
</script>

<style>
	.content {
		height: 100%;
		width: 100%;
		overflow-x: hidden;
	}
	.box{
		width: calc(100% - 48rpx);
		margin-left: 24rpx;
		margin-top: 24rpx;
		background: #ffffff;
		border-radius: 12rpx;
		height: 452rpx;
	}
	.title_box{
		display: flex;
		align-items: center;
		padding-top: 24rpx;
		margin-left: 24rpx;
		margin-bottom: 24rpx;
	}
	.title_box img{
		width: 80rpx;
		height: 80rpx;
		margin-right: 24rpx;
	}
	.title_title{
		font-size: 32rpx;
		color: #333333;
	}
	.title_sub{
		color: #999999;
		font-size: 24rpx;
	}
	.data_box{
		display: flex;
		padding-top: 24rpx;
		width: calc(100% - 48rpx);
		margin-left: 24rpx;
		align-items: center;
		justify-content: space-between;
		padding-bottom: 24rpx;
	}
	.data_title{
		font-size: 28rpx;
		color: #666666;
	}
	.data_count{
		font-size: 28rpx;
		color: #666666;
	}
	.border{
		width: calc(100% - 48rpx);
		margin-left: 24rpx;
		background-color: #eeeeee;
		height: 2rpx;
	}
	.btn{
		width: calc(100% - 48rpx);
		margin-left: 24rpx;
		text-align: center;
		background-color: #13A684;
		border-radius: 12rpx;
		height: 100rpx;
		line-height: 100rpx;
		color: #ffffff;
		font-size: 28rpx;
		margin-top: 24rpx;
	}
</style>
